package com.linkpow.smartelevator.exception;

import com.linkpow.smartelevator.common.ErrorMessage;

/**
 * @ClassName PlatformException
 * @Description 平台异常
 * @Author 王丹
 * @Date 2019/11/25 13:55
 * @Version 1.0
 */
public class PlatformException extends Exception {

    private String code;

    public PlatformException(String message){
        this(ErrorMessage.FAIL.getMessageCode(), message);
    }

    public PlatformException(String code, String message){
        super(message);
        this.code = code;
    }

    public PlatformException(String message, Throwable cause){
        this(ErrorMessage.FAIL.getMessageCode(), message, cause);
    }

    public PlatformException(String code, String message, Throwable cause){
        super(message, cause);
        this.code = code;
    }

    public PlatformException(ErrorMessage errorMessage, Throwable cause){
        this(errorMessage.getMessageCode(), errorMessage.getMessageValue(), cause);
    }

    public String getCode() {
        return code;
    }

}
